package com.wangsd.web.shop.service;

import com.wangsd.web.shop.entity.Test;
import com.wangsd.web.shop.mapper.TestMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class TestService {

    @Resource
    TestMapper mapper;

    @Transactional
    public void save(Integer amount) {
        Test test = mapper.getById(1L);
        test.setAmount(test.getAmount() + amount);
        mapper.updateIgnoreNull(test);
    }

    @Transactional
    public void save2(Integer amount) {
        Test test = mapper.getById(1L);
        test.setAmount(test.getAmount() + amount);
        mapper.updateIgnoreNull(test);
    }
}
